<template>
  <svg :style="{ width, height }">
    <!-- href的值必须符合上面定义要求，fill标识填充颜色 -->
    <use :xlink:href='prefix + name' :fill="color"></use>
  </svg>
</template>

<script setup lang="ts">
defineProps({
  prefix: {
    type: String,
    default: "#icon-"
  },
  name: {
    type: String,
    require: true,
  },
  color: {
    type: String,
    default: 'red'
  },
  width: {
    type: String,
    default: '15px'
  },
  height: {
    type: String,
    default: '15px'
  }
});
</script>

<style scoped></style>